﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Sinbiota.Web.Models.LogListModel>" %>
<%@ Import Namespace="Localization" %>
<%@ Import Namespace="MvcContrib.UI.Pager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%: Strings.ListAll %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2><%: Strings.ListAll %></h2>
     <% using (Html.BeginForm())
        {%>
        <div class="display-label">
            <%: Strings.Level %>: 
            <%:Html.DropDownListFor(m => m.SelectedLevel, Model.LogLevels, Strings.AllLevels , new { onchange = "this.form.submit();" })%>
        </div>
    <%
        }%>

        <span class="display-label"> <%= Html.Pager(Model.Logs) %></span>

        <% using (Ajax.BeginForm("AjaxDetails", null, new AjaxOptions { UpdateTargetId = "LogDetails", OnSuccess = "function() {showDetails('Log');}" }, new { id = "LogDetailsAjaxForm" }))
           { %>
            <%: Html.Hidden("id")%>
        <% } %>

    <table>
    <thead>
        <tr class="header">
             <th width="40"></th>
            <th>
                Id
            </th>
            <th>
                <%: Strings.Date %>
            </th>
            <th>
                <%: Strings.Level %>
            </th>
            <th>
                Logger
            </th>
            <th>
                <%: Strings.User%>
            </th>
        </tr>
    </thead>
    <% foreach (var item in Model.Logs) { %>
    
        <tr>
            <td>
                <%= Html.ActionLink("REPLACE", "Details", new { id = item.Id }).ToString().
        Replace("REPLACE", "<img title='" + Strings.Details + "' border=0 src='" + Url.Content("~/Content/img/details.png") + "' >")%>            </td>
            <td>
                <a href="javascript:requestDetails('Log',<%: item.Id %>);"><%: item.Id %></a>
            </td>
            <td>
                <%: String.Format("{0:g}", item.Date) %>
            </td>
            <td>
                <%: item.Level %>
            </td>
            <td>
                <%: item.Logger %>
            </td>
            <td>
                <%: item.AuthUser %>
            </td>

        </tr>
        
        
    <% } %>
    </table>

    <div id="LogDetails" title="Log Details"></div>
    </asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript" src="<%: Url.Content("~/Scripts/Custom/BiotaAjaxFunctions.js")%>"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            if (!$.browser.mozilla) $("form").submit(function (event) { eval($(this).attr("onsubmit")); return false; });
        });
    </script>
</asp:Content>

